from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.settings import config


def init_middlewares(app: FastAPI):
    """初始化中间件"""
    app.add_middleware(
        CORSMiddleware,
        allow_origins=config.CORS_ORIGINS,
        allow_credentials=config.CORS_ALLOW_CREDENTIALS,
        allow_methods=config.CORS_ALLOW_METHODS,
        allow_headers=config.CORS_ALLOW_HEADERS,
    )



